package com.lizhenhua.fmmall.controller;

import com.lizhenhua.fmmall.service.serviceImpl.UserAddrServiceImpl;
import com.lizhenhua.fmmall.vo.ResultVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.apiguardian.api.API;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@CrossOrigin
@Api(value = "提供收货地址相关接口",tags = "收货地址管理")
@RequestMapping("/userAddr")
public class UserAddrController {
    @Autowired
    private UserAddrServiceImpl userAddrService;

    @ApiOperation(value = "地址-获取用户的地址")
    @ApiImplicitParams({
            @ApiImplicitParam(dataType = "Integer", name = "userId", value = "用户的id(userId)", required = true),
    })
    @GetMapping("/addr/{userId}")
    public ResultVo listAddr(@PathVariable("userId") Integer userId,@RequestHeader("token") String token){
        ResultVo resultVo = userAddrService.getAddressByUserId(userId);
        return  resultVo;
    };
}
